<!DOCTYPE >
<html lang="zh-cn">
<head>
		<title>后台管理-功能</title>
    <% include ../partials/head %>
    <script type="text/javascript">
        var oRecommend={
            operation:function(){
                $(".box-content").on("click",".agree",function(){
                    $this = $(this)
                    if(window.confirm('你确定要入驻该人么？')){
                        $.post("/admin/inPocketApply/agree",{
                            "userId":$this.attr('userId'),
                            "applyId":$this.attr('applyId');
                        },function(json){
                            if(json.code==0){
                                history.go(0);
                            }else{
                                alert(json.msg);
                            }
                        },'json');
                    }else{
                        //取消
                    }
                })
                $(".pass").on('click',function(){
                    $this = $(this)
                    content = $this.prev().val().trim();
                    if(window.confirm('你确定拒绝并回复该用户么？')){
                        $.post("/admin/inPocketApply/refuse",{
                            "userId":$this.attr('userId'),
                            "content":content,
                            "applyId":$this.attr('applyId');
                        },function(json){
                            if(json.code==0){
                                history.go(0);
                            }else{
                                alert(json.msg);
                            }
                        },'json');
                    }else{
                        //取消
                    }
                })
            },
            change:function(){
                var num =window.location.href.split("=")[1];
                $("#article-filter option[value='"+num+"']").attr("selected","selected");
                $("#article-filter").on("change",function(){
                    var value = $(this).children('option:selected').val(); 
                    window.location.href="/admin/inPocketApply?num="+value;
                })
            },
            init:function(){
                this.operation();
                this.change();
            }
        }
        $(document).ready(function(){
            oRecommend.init();
        })
    </script>

</head>
<body>
	<header>
    <% include ../partials/header %>
  </header>
  <div class="ch-container">
    <div class="row">
      <% include ../partials/sidebar %>
      <!-- 页面内容 -->
      <div id="content" class="col-lg-10 col-sm-10">
        <div class="row">
          <div class="box col-md-12">
            <div class="box-inner">
              <div class="box-header well" data-original-title="">
                <div class="control-group">
                  <div class="controls">
                    <label class="control-label" for="selectError">筛选:&nbsp&nbsp&nbsp </label>
                    <select id="article-filter" >
                        <option value="0">前1000人</option>
                        <option value="1000">1000~2000</option>
                        <option value="2000">2000~3000</option>
                        <option value="3000">3000~4000</option>
                        <option value="4000">4000~5000</option>
                        <option value="5000">5000~6000</option>
                        <option value="6000">6000~7000</option>
                        <option value="7000">7000~8000</option>
                        <option value="8000">8000~9000</option>
                        <option value="9000">9000~1w</option>
                    </select>
                  </div>
                  
                </div>
              </div>

              <div class="box-content">
                <table class="table table-striped table-bordered bootstrap-datatable datatable responsive">
                  <thead>
                    <tr>
                      <th></th>
                      <th>用户昵称</th>
                      <th>口袋ID</th>
                      <th>联系他</th>
                      <th>创建时间</th>                  
                      <th>操作</th>
                    </tr>
                  </thead>

                  <tbody>
                    <% if (typeof inpocketApplays != "undefined") { %>
                      <% inpocketApplays.forEach(function(inpocketApplay,index) { %>
                        <tr>
                          <td class="center"><%=index%></td>                         
                          <td class="center"><a href="/admin/userinfo?userId=<%=inpocketApplay.get("user").id%>" target="_blank"><%= inpocketApplay.get("user").get("nickname") %></a></td>
                          <td class="center"><%= inpocketApplay.get("user").get("molianId") %></td>
                          <td class="center"><a href="/admin/userinfo?userId=<%= inpocketApplay.get("user").id%>"><%= inpocketApplay.get("user").get("nickname") %></a>
                          	<p><input class="contactContent" type="text" placeholder="联系他">
					      		<span class="btn btn-success contact " userId=<%=inpocketApplay.get("user").id%>>
	                              <i class="glyphicon glyphicon-warning-sign icon-white"></i>
	                             联系他
	                          	</span></p></td>
                          <td class="center"><%= Format(inpocketApplay.createdAt) %></td>
                          <td class="center">
                                <input class="warnContent" type="text" placeholder="拒绝内容">
					      		<span class="btn btn-success pass " applyId=<%=inpocketApplay.id%> userId=<%=inpocketApplay.get("user").id%>>
	                              <i class="glyphicon glyphicon-warning-sign icon-white"></i>
	                             拒绝
	                          	</span>
	                          	<span class="btn btn-danger agree" applyId=<%=inpocketApplay.id%> userId=<%=inpocketApplay.get("user").id%>>
	                              <i class="glyphicon glyphicon-remove icon-white"></i>
	                             设置入驻
	                          	</span>
                          </td>
                        </tr>
                      <% }) %>
                    <% } %>
                  </tbody>
                </table>
              </div>

            </div>
          </div>
        </div>
      </div>


    </div>

    <% include ../partials/footer %>
  </div>
  <% include ../partials/external %>
</body>
</html>
<!--  -->